package program

import org.springframework.cloud.contract.spec.Contract

Contract.make {
    request {
        method 'POST'
        url value(consumer(regex('/api/programs/\\d+/students')), producer('/api/programs/1/students'))
        body ([
                'usernames':'zhang'
        ])
        bodyMatchers {
            jsonPath('$.usernames', byRegex(nonEmpty()))
        }
        headers {
            contentType(applicationJsonUtf8())
        }
    }
    response {
        status 201
    }
}